<?php
#cowa-japan.co.jp 定义文件

# 时间轴
date_default_timezone_set('Japan');
header("Content-type: text/html; charset=utf-8"); 

class config{
	
	const ajax_json_ref = 'ref';
	const ajax_json_ref_default = 'error';
	# 常量
	const version = '0.0.8';
	const conf_web_root = '/';
	const conf_web_listcount = 10;
	const conf_web_pagecount = 25;
	# database
	const conf_db_type = 'mysql';
	const conf_db_host = 'localhost';// 222.73.218.200 // localhost // mysql241.db.sakura.ne.jp
	const conf_db_user = 'chilcoo';// dantiv // root // chilcoo
	const conf_db_password = 'F0099873a';
	const conf_db_name = 'chilcoo'; // chilcoo
	const conf_db_lang = 'utf8';
	
	# 加载模板引擎
	const conf_web_template = '/__smarty/templates/';
	const conf_web_lang = '/__smarty/lang/';
	const conf_web_compile = '/__smarty/templates_c/';
	const conf_web_configs = '/__smarty/configs/';
	const conf_web_cache = '/__smarty/cache/';
	const conf_web_left_delimi = '<{';
	const conf_web_right_delim = '}>';
	const conf_web_def_lang = 'ja-jp';
	const conf_web_encode = 'uft-8';
	const conf_web_power = 'power by Chilcoo Inc.';
	const conf_web_superuser = 'administrator';
	
	const exe_code_order = '4B785921-D096-4AE6-BCB1-8B349AE092D6';
	const exe_code_contact = '643B33DC-6244-4DEE-BE73-653567818DEE';
	
	# 程序目录
	var $conf_web_path;
	# 周期
	var $web_page_period;
	# 模板相关
	var $smarty;
	var $temp_page_path;
	var $conf_lang_folder;
	# 创建
	function __construct(){
		$this->conf_web_path = dirname(__FILE__);
		$this->temp_page_path = str_replace('/','_',$_SERVER['PHP_SELF']);
	}
	# 模板加载模板
	function set_smarty(){
		# 加载语言系统(所有对应.php语言包全部加载)
		$this->conf_lang_folder = opendir($this->conf_web_path.config::conf_web_lang.config::conf_web_def_lang);
		while (false !== ($file = readdir($this->conf_lang_folder))) {
			if(basic::getExt($file) == 'php'){
				require_once ($this->conf_web_path.config::conf_web_lang.config::conf_web_def_lang.'/'.$file);
			}
		}
		# 加载模板类
		if($_SERVER['SERVER_NAME'] == 'localhost'){
			require_once(dirname(__FILE__).'/../cs2/include/smarty/Smarty.class.php');
		}else{
			# 上传服务器时使用
			require_once(dirname(__FILE__).'/cs2/include/smarty/Smarty.class.php');
		}
		# 模板启动
		$this->smarty = new Smarty();
		$this->smarty->template_dir = $this->conf_web_path.config::conf_web_template;
		$this->smarty->compile_dir = $this->conf_web_path.config::conf_web_compile;
		$this->smarty->config_dir = $this->conf_web_path.config::conf_web_configs;
		$this->smarty->cache_dir = $this->conf_web_path.config::conf_web_cache;
		$this->smarty->left_delimiter = config::conf_web_left_delimi;
		$this->smarty->right_delimiter = config::conf_web_right_delim;
		# 导入标准语言包
		$this->smarty->assign($lang);
		# 导入超级管理员变量
		$this->smarty->assign('db_superuser',config::conf_web_superuser);
	}
}

$config = new config();
# 初始化Smarty
$config->set_smarty();

?>